<?php

declare(strict_types=1);
/*
 * This file is part of eelly package.
 *
 * (c) eelly.com
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Eelly\SDK\Activity\Api;

use Eelly\DTO\UidDTO;
use Eelly\SDK\EellyClient;

/**
 * class UserCoupon
 * 
 * @author sunanzhi <sunanzhi@hotmail.com>
 */
class UserCoupon
{
    public static function checkIsSendWechatCoupon(int $userId, int $couponStockId): bool
    {
        return EellyClient::requestJson('activity/userCoupon', __FUNCTION__, [
            'userId' => $userId,
            'couponStockId' => $couponStockId
        ]);
    }

    public static function receive(int $acoId, int $issueFlag, UidDTO $user = null): bool
    {
        return EellyClient::requestJson('activity/userCoupon', __FUNCTION__, [
            'acoId' => $acoId,
            'issueFlag' => $issueFlag,
            'user' => $user
        ]);
    }

    public static function receiveForInternal(int $acoId, int $issueFlag, string $couponSn = '', int $userId): bool
    {
        return EellyClient::requestJson('activity/userCoupon', __FUNCTION__, [
            'acoId' => $acoId,
            'issueFlag' => $issueFlag,
            'couponSn' => $couponSn,
            'userId' => $userId
        ]);
    }

    public static function getAvailableWechatCouponList(): array
    {
        return EellyClient::requestJson('activity/userCoupon', __FUNCTION__, []);
    }

    public static function getUserAvailableWechatCouponList(string $appId, int $userId): array
    {
        return EellyClient::requestJson('activity/userCoupon', __FUNCTION__, [
            'appId' => $appId,
            'userId' => $userId
        ]);
    }

    public static function getAllStoreLowestCoupon(): array
    {
        return EellyClient::requestJson('activity/userCoupon', __FUNCTION__, []);
    }

    public static function groupChatCouponList(int $storeId): array
    {
        return EellyClient::requestJson('activity/userCoupon', __FUNCTION__, [
            'storeId' => $storeId
        ]);
    }
}